<?php

declare(strict_types=1);

namespace app\model;

use think\Model;
use think\model\concern\SoftDelete;

class OrderItem extends Model
{
    use SoftDelete;

    protected $name = 'order_items';

    protected $autoWriteTimestamp = 'datetime';

    protected $json = ['product_snapshot'];

    public function order()
    {
        return $this->belongsTo(Order::class, 'order_id');
    }

    public function product()
    {
        return $this->belongsTo(Prod::class, 'product_id');
    }
}
